package exception;

public class ExceptionAPIDemo {
    public static void main(String[] args) {
        System.out.println("程序开始了");
        try {
            String str = "abcd";
            //Integer.parseInt(str))是将整型数据Integer转换为基本数据类型int
            System.out.println(Integer.parseInt(str));
        } catch (NumberFormatException e) {
            System.out.println("出错了");

            //获取错误消息
            e.printStackTrace();
            //输出错误消息
            String message = e.getMessage();
            System.out.println(message);
        }
        System.out.println("程序结束了");
    }
}
